package com.LachesismStorm.lachesism.member.controller;

import com.LachesismStorm.lachesism.core.common.response.ResponsePage;
import com.LachesismStorm.lachesism.core.common.response.ResponseResult;
import com.LachesismStorm.lachesism.member.vo.TftVO.Lineup;
import com.LachesismStorm.lachesism.member.vo.TftVO.TftCharacterInfo;
import com.LachesismStorm.lachesism.member.vo.TftVO.TftEquipment;
import com.LachesismStorm.lachesism.member.service.TftControllerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author lachesism
 * @Date 2024-06-05 01:41
 **/
@RestController
@Api(tags = "云顶")
@RequestMapping("/tft")
public class TftController {
    @Resource
    private TftControllerService tftControllerService;

    @Resource
    private RedisTemplate<String, Object> redisTemplate;


    @ApiOperation(value = "获取阵容列表")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "pageNum", value = "页数"),
            @ApiImplicitParam(paramType = "query", name = "season", value = "赛季"),
    })
    @PostMapping("/getLineupList")
    public ResponseResult getLineupList(@RequestParam Integer pageNum, @RequestParam Integer season) {
        ResponsePage<Lineup> lineupList = tftControllerService.getLineupList(pageNum, season);
        return ResponseResult.success(lineupList, "查询成功");
    }

    @ApiOperation(value = "通过英雄名获取阵容列表")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "season", value = "赛季"),
            @ApiImplicitParam(paramType = "query", name = "hero", value = "英雄名")
    })
    @PostMapping("/getLineupByHero")
    public ResponseResult getLineupByHero(@RequestParam Integer season, @RequestParam String hero) {
        List<Lineup> lineupList = tftControllerService.getLineupByHero(season,hero);
        return ResponseResult.success(lineupList, "查询成功");
    }

    @ApiOperation(value = "获取阵容详情")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "id", value = "阵容id"),
    })
    @PostMapping("/getLineupInfo")
    public ResponseResult getLineupInfo(@RequestParam Integer id) {
        Lineup lineup = tftControllerService.getLineupInfo(id);
        return ResponseResult.success(lineup, "查询成功");
    }

    @ApiOperation(value = "添加阵容")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "Lineup", value = "阵容信息"),
    })
    @PostMapping("/addLineup")
    public ResponseResult addLineup(@RequestBody Lineup lineup) {
        tftControllerService.addLineup(lineup);
        return ResponseResult.success(lineup, "添加成功");
    }

    @ApiOperation(value = "查询所有英雄")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "season", value = "版本号"),
    })
    @PostMapping("/getAllCharacter")
    public ResponseResult getAllCharacter(@RequestParam Integer season) {
        List<TftCharacterInfo> getAllCharacter = tftControllerService.getAllCharacter(season);
        return ResponseResult.success(getAllCharacter, "查找成功");
    }

    @ApiOperation(value = "查询所有装备")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "season", value = "版本号"),
    })
    @PostMapping("/getAllEquipment")
    public ResponseResult getAllEquipment(@RequestParam Integer season) {
        List<TftEquipment> allEquipment = tftControllerService.getAllEquipment(season);
        return ResponseResult.success(allEquipment, "查找成功");
    }



}
